<?php
	include_once("../service/dishInDayService.php");

	$availableDishIds = $_POST['availableList'];
	$relatedListIds = $_POST['relatedList'];
	$dayId = $_POST['day'];
	
	if(isset($availableDishIds)){
		foreach($availableDishIds as $id){
			removeDishInDay($id, $dayId);
		}
	}
	
	if(isset($relatedListIds)){
		foreach($relatedListIds as $id){
			addDishInDay($id, $dayId);
		}
	}
	
	Header("Location: ../admin-page/menu.php?message=ok&day=$dayId");
?>